<%# $Id$  -%>

<h2><%=@report.form.name%> (<%=@report.start_date%> - <%=@report.due_date%>)</h2>

<h3><%=l(:label_team_stats)%></h3>

<div class="stats_content" style="margin-left:15px;margin-bottom:15px;">
<table class="list team_stats" style="width:50%;">
  <thead>
    <tr class="team_stats">
      <th class="name"><%=l(:label_name)%></th>
      <th class="num_of_members"><%=l(:label_number_of_members)%></th>
      <th class="estimated_hours"><%=l(:label_work_time_estimated)%></th>
      <th class="spent_hours"><%=l(:label_work_time_spent)%></th>
    </tr>
  </thead>
<% reset_cycle -%>
<% @report.teams.each do |team|-%>
  <tbody>
    <tr class="team <%= cycle('odd', 'even') %>">
      <td class="name"><%=team.name%></td>
      <td class="num_of_members"><%=team.members.length%></td>
      <td class="estimated_hours"><%=@report.estimated_hours(team)%></td>
      <td class="spent_hours"><%=@report.spent_hours(team)%></td>
    </tr>
 <% end %>
  </tbody>
</table>
</div>

<h3><%=l(:label_ticket_stats)%></h3>

<div class="stats_content" style="margin-left:15px;margin-bottom:15px;">
<% @report.issue_groups.each do |group|-%>
<h4><%=group.query.name%></h4>
<table class="list issues" style="width:90%;">
  <thead>
    <tr class="issue">
      <th class="id">#</th>
      <th class="title" style="width:30em;"><%=l(:field_title)%></th>
      <th class="status"><%=l(:field_status)%></th>
      <th class="start_date"><%=l(:field_start_date)%></th>
      <th class="due_date"><%=l(:field_due_date)%></th>
      <th class="estimated_hours"><%=l(:field_estimated_hours)%></th>
      <th class="spent_hours"><%=l(:label_spent_time_current)%></th>
      <th class="spent_hours"><%=l(:label_spent_time_total)%></th>
    </tr>
  </thead>
  <tbody>
<% reset_cycle -%>
<% issue_list(@report.issues(group)) do |issue, level| -%>
    <tr class="issue <%= cycle('odd', 'even') %> <%="idnt idnt-#{level}" if level > 0%>">
      <td class="id"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>
      <td class="subject"><%= link_to issue.subject, :controller => 'issues', :action => 'show', :id => issue %></td>
      <td class="status"><%=issue.status%></td>
      <td class="start_date"><%=issue.start_date%></td>
      <td class="due_date"><%=issue.due_date%></td>
      <% first_estimate = issue_first_esitimate(issue) -%>
      <td class="estimated_hours"><%=issue.estimated_hours%><%=" (#{first_estimate})" if first_estimate.length > 0%></td>
      <td class="spent_hours"><%=issue_spent_hours(issue, @report.start_date, @report.due_date)%></td>
      <td class="spent_hours"><%=issue.spent_hours%></td>
    </tr>
<% end -%>
  </tbody>
</table>
<% end -%>
</div>

<h3><%=l(:label_code_stats)%></h3>
